#!/bin/bash
fun_bar () {
comando[0]="$1"
comando[1]="$2"
 (
[[ -e $HOME/fim ]] && rm $HOME/fim
${comando[0]} -y > /dev/null 2>&1
${comando[1]} -y > /dev/null 2>&1
touch $HOME/fim
 ) > /dev/null 2>&1 &
 tput civis
echo -ne "  \033[1;33mTUNGGU \033[1;37m- \033[1;33m["
while true; do
   for((i=0; i<18; i++)); do
   echo -ne "\033[1;31m#"
   sleep 0.1s
   done
   [[ -e $HOME/fim ]] && rm $HOME/fim && break
   echo -e "\033[1;33m]"
   sleep 1s
   tput cuu1
   tput dl1
   echo -ne "  \033[1;33mTUNGGU \033[1;37m- \033[1;33m["
done
echo -e "\033[1;33m]\033[1;37m -\033[1;32m OK !\033[1;37m"
tput cnorm
}
cd /root
echo -e "Menghentikan layanan DNS"
fun_stop () {
screen -ls | grep slowdns | cut -d. -f1 | awk '{print $1}' | xargs kill
sleep 1.5
}
fun_bar 'fun_stop'
echo ""
echo -e "Menghapus SlowDNS"
fun_rm () {
rm /etc/rc.local; mv /etc/rc.local.bkp /etc/rc.local
sleep 1.5
}
fun_bar 'fun_rm'
echo ""
fun_revdns () {
echo "nameserver 8.8.8.8" > /etc/resolv.conf
systemctl enable systemd-resolved.service && systemctl start systemd-resolved.service &&
sleep 1.5
}
fun_bar 'fun_revdns'
echo ""
echo -e "SlowDNS Berhasil Dihapus!"
rm -rf /etc/slowdns